package middle;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 567. 字符串的排列
 */
public class CheckInclusion {
    public static String stringToString(String input) {
        if (input == null) {
            return "null";
        }
        return input.toString();
    }

    public static String booleanToString(boolean input) {
        return input ? "True" : "False";
    }

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while ((line = in.readLine()) != null) {
            String s1 = stringToString(line);
            line = in.readLine();
            String s2 = stringToString(line);

            boolean ret = checkInclusion(s1, s2);

            String out = booleanToString(ret);

            System.out.print(out);
        }
    }
    public static boolean checkInclusion(String s1, String s2) {
        char[] char1 = s1.toCharArray();
        Arrays.sort(char1);
        String newStr = String.valueOf(char1);
        char[] char2 = s2.toCharArray();
        int left = 0;
        while (left<char2.length){
            if (newStr.indexOf(char2[left])>-1){
                if (check(newStr,char2,left,true)){
                    return true;
                }
            }
            left++;
        }
        return false;
    }

    public static boolean check(String newStr,char[] char2,int index,boolean isAsc){
        if (index+newStr.length()>char2.length){
            return false;
        }
        String str2 = String.valueOf(char2,index,newStr.length());
        char[] chars = str2.toCharArray();
        Arrays.sort(chars);
        String newStr2 = String.valueOf(chars);
        if (newStr2.equals(newStr)){
            return true;
        }
        return false;
    }
}
